home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14233 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.5 KB  |  69 lines

  1. Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather
  2. Path: newsfeed.acns.nwu.edu!ftpbox!mothost!schbbs!news
  3. From: shang@corp.mot.com (David L. Shang)
  4. Subject: Re: What Should An Exception Handling Do? -- Clarification of rules
  5. Reply-To: shang@corp.mot.com
  6. Organization: MOTOROLA 
  7. Date: Fri, 29 Mar 1996 16:25:24 GMT
  8. Message-ID: <1996Mar29.162524.28067@schbbs.mot.com>
  9. References: <4je18p$lnr@dscomsa.desy.de>
  10. Sender: news@schbbs.mot.com (SCHBBS News Account)
  11. Nntp-Posting-Host: 129.188.128.126
  12.  
  13.  
  14. In article <4je18p$lnr@dscomsa.desy.de> mernst@x4u2.desy.de (Matthias Ernst)  
  15. writes:
  16. > I also agree but have some problem about the way the exception handler
  17. > passes back information to the 'thrower'. Or, the other way around, how can
  18. > the 'thrower' ask for dedicated information in an anonymous outer frame
  19. > (a la 'Do you really not want to save your changes ?')
  20. > I fear, for retry-semantics the handler is too near to the thrower, too deep
  21. > in the hierarchy to provide this information.
  22. > try
  23. >   font = getfont(name, size)
  24. > except exc: FontNotAvailable
  25. >   ask_for_new_font(out name, out size)
  26. >   -- Ask the user here ? We're deep in the functional part, 
  27. >      not aware of our user interface
  28. >   retry
  29. > end;
  30. > With resumption-semantics the handler might alter the exception object:
  31. > try
  32. >   init_interface -- which is a deep hierarchy
  33. > except exc: FontNotAvailable
  34. >   ask_for_new_font(out name, out size)
  35. >   exc.new_font_name = name
  36. >   exc.new_font_size = size
  37. >   resume
  38. > end;
  39.  
  40. Good examples. I am not sure whether it is pratically sufficient
  41. if we just provide one-level correspondence between caller and callee
  42. on the retry-semantics base. For example, initialize interface is usually
  43. done in the application develoipers and they should know how to deal
  44. with exceptions like font is not found.
  45.  
  46. If deep levels are involved, resumption-semantics may be helpful to
  47. avoid to re-initialize the whole interface. But we perhaps can
  48. have a retry on the smallest try cloure where the exception is thrown,
  49. rather than a resumption exactly from the point the exception is trown.
  50.  
  51. > But I fear that at the toplevel all the handlers for missing information
  52. > accumulate to a great mess.
  53.  
  54. I agree that to handle deep level resumption/retry is very complicated, and
  55. it seems that there were no neat solution.
  56.  
  57. In my personal experience with a number of user interface designs, I've
  58. been happy with just one-level correspondence between callers and callees.
  59.  
  60. David Shang
  61.  
  62.  
  63.  
  64.